package seatiger.tomcat.coyote.http11.filters;

import seatiger.tomcat.coyote.InputBuffer;
import seatiger.tomcat.coyote.Request;
import seatiger.tomcat.coyote.http11.InputFilter;
import seatiger.tomcat.util.buf.ByteChunk;

import java.io.IOException;

/**
 * 如果报文体没有内容，就是content-length = 0或者没有content-length，
 * 那么就执行这个过滤器
 */
public class VoidInputFilter implements InputFilter {
    @Override
    public int doRead(ByteChunk byteChunk, Request request) throws IOException {
        return -1;
    }

    @Override
    public void setRequest(Request request) {
    }

    @Override
    public void recycle() {
    }

    @Override
    public void setBuffer(InputBuffer inputBuffer) {
    }

    @Override
    public long end() throws IOException {
        return 0;
    }
}
